package com.slipper.codeless.resolve.query;

public class SortField {
    /* 表前缀 */
    private String tableAlias;
    /* 字段名称 */
    private String fieldName;
    /* 排序方式： asc：升序 desc：降序 */
    private String ordinalMode;
    /* 排序 */
    private Integer ordinal;

    public SortField(String fieldName, String ordinalMode, Integer ordinal) {
        this.fieldName = fieldName;
        this.ordinalMode = ordinalMode == null ? "asc" : ordinalMode;
        this.ordinal = ordinal;
    }

    public SortField(String tableAlias, String fieldName, String ordinalMode, Integer ordinal) {
        this.tableAlias = tableAlias;
        this.fieldName = fieldName;
        this.ordinalMode = ordinalMode == null ? "asc" : ordinalMode;
        this.ordinal = ordinal;
    }

    public String getTableAlias() {
        return tableAlias;
    }

    public void setTableAlias(String tableAlias) {
        this.tableAlias = tableAlias;
    }

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    public String getOrdinalMode() {
        return ordinalMode;
    }

    public void setOrdinalMode(String ordinalMode) {
        this.ordinalMode = ordinalMode;
    }

    public Integer getOrdinal() {
        return ordinal;
    }

    public void setOrdinal(Integer ordinal) {
        this.ordinal = ordinal;
    }
}
